<!-- 职级编辑弹窗 -->
<template>
    <el-dialog
      title="查看发送日志"
      :visible="visible"
      width="90%"
      :destroy-on-close="true"
      :lock-scroll="false"
      @open="loaddata"
      @update:visible="updateVisible">
      
      <ele-pro-table
        ref="logtable"
        :where="where"
        :datasource="url"
        :columns="columns"
        height="calc(100vh - 415px)">
        <template slot="submitNo" slot-scope="{row}">
          <div style="white-space:pre-wrap">{{ row.submitNo }}</div>
        </template>
        <template slot="submitTime" slot-scope="{row}">
          <div style="white-space:pre-wrap">{{ row.submitTime }}</div>
        </template>
        <template slot="reqBody" slot-scope="{row}">
          <el-input type="textarea" :rows="4" :value="row.requestBody"></el-input>
        </template>
        <template slot="resBody" slot-scope="{row}">
          <el-input type="textarea" :rows="4" :value="row.responseBody"></el-input>
        </template>
      </ele-pro-table>

      <div slot="footer">
        <el-button @click="updateVisible(false)">关闭</el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  export default {
    name: 'SubmitLogList',
    props: {
      // 弹窗是否打开
      visible: Boolean,
      // 修改回显的数据
      dataItem: Object
    },
    data() {
      return {
        // 表单数据
        url: '/spbcsubmitlog/index',
        // 表格列配置
        columns: [
          {
            prop: 'submitNo',
            label: '提交编号',
            showOverflowTooltip: true,
            minWidth: 100,
            align: 'center',
            slot:'submitNo'
          },
          {
            prop: 'requestBody',
            label: '提交报文',
            showOverflowTooltip: true,
            minWidth: 200,
            align: 'center',
            slot:'reqBody'
          },
          {
            prop: 'responseBody',
            label: '返回结果',
            showOverflowTooltip: true,
            minWidth: 200,
            align: 'center',
            slot:'resBody'
          },
          {
            prop: 'responseCode',
            label: '返回状态',
            showOverflowTooltip: true,
            minWidth: 100,
            align: 'center'
          },
          {
            prop: 'submitTime',
            label: '提交时间',
            showOverflowTooltip: true,
            minWidth: 100,
            align: 'center',
            slot:'submitTime'
          },

        ],
        // 表格搜索条件
        where: {danjNo:this.dataItem?this.dataItem.sqdh:''},
        // 提交状态
        loading: false,
      };
    },
    watch: {
      data() {
        if (this.dataItem) {
          this.form = Object.assign({}, this.dataItem);
        } else {
          this.form = {};
        }
      }
    },
    methods: {
      loaddata(){
        if (this.dataItem) {
          this.where.danjNo = this.dataItem.sqdh;
          this.$refs["logtable"].reload({where: this.where});
        }        
      },
      /* 更新visible */
      updateVisible(value) {
        this.$emit('update:visible', value);
      }
    }
  }
  </script>
  
  <style scoped>
  .el-table .cell {
  white-space: pre-wrap;   /*这是重点。文本换行*/
}
  </style>
  